﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using QuanLiBongDa.DataAccessLayer;
using System.Windows.Forms;
namespace QuanLiBongDa.BusinessLogicLayer
{
    class QuanLiDoiBongBLO
    {
        SanDAO sa = SanDAO.CreateSanDAO();
        DoiBongDAO db =DoiBongDAO.CreateDoiBongDAO();
        CauThuDAO ct = CauThuDAO.CreateCauThuDAO();
        LoaiCauThuDAO lct = LoaiCauThuDAO.CreateLoaiCauThu();
        #region Sân
        public bool Insert_San(SanDTO s)
        {
            return sa.Insert_San(s);
        }
        public bool Update_San(SanDTO s)
        {
            return sa.Update_San(s);
        }
        public bool Delete_San(SanDTO s)
        {
            return sa.Delete_San(s);
        }
        public DataTable San(string sql)
        {
            return SQLService.FillTable(sql);
        }
        public DataTable TimMS_Ten(string tensan)
        {
            return sa.TimMS_Ten(tensan);
        }
        #endregion
        #region Đội Bóng
        public bool Insert_DoiBong(DoiBongDTO d)
        {
            return db.Insert_DoiBong(d);
        }
        public bool Update_DoiBong(DoiBongDTO d)
        {
            return db.Update_DoiBong(d);
        }
        public bool Delete_DoiBong(DoiBongDTO d)
        {
            return db.Delete_DoiBong(d);
        }
        public void MaSan(ComboBox masan)
        {
            db.MaSan(masan);
        }
        public DataTable TimMD_Ten(string tendoi)
        {
            return db.TimMD_Ten(tendoi);
        }
        public DataTable LoadDoiBong(string str)
        {
            return SQLService.Table_Reader(str);//str="LoadDoiBong"
        }
        #endregion
        #region Cầu Thủ
        public bool Insert_CauThu(CauThuDTO c)
        {
            CauThuDAO a = new CauThuDAO();
            return a.Insert_CauThu(c);
        }
        public bool Update_CauThu(CauThuDTO c)
        {
            CauThuDAO a = new CauThuDAO();
            return a.Update_CauThu(c);
        }
        public bool Delete_CauThu(CauThuDTO c)
        {
            CauThuDAO a = new CauThuDAO();
            return a.Delete_CauThu(c);
        }                
        public DataTable TimMLCT_Ten(string loaict)
        {
            LoaiCauThuDAO lct = new LoaiCauThuDAO();
            return lct.TimMLCT_Ten(loaict);
        }        
        public DataTable LoadCauThu(string srt)
        {
            return SQLService.Table_Reader(srt);
        }
        public void MaDoi(ComboBox madoi)
        {
            ct.MaDoi(madoi);
        }
        public void MaLCT(ComboBox malct)
        {
            lct.MaLCT(malct);
        }
        #endregion
    }
}
